KAFKA-20120: Create HeadersSerializer and HeadersDeserializer#21401
Open
frankvicky wants to merge 3 commits intoapache:trunkfrom
Open
KAFKA-20120: Create HeadersSerializer and HeadersDeserializer#21401frankvicky wants to merge 3 commits intoapache:trunkfrom
frankvicky wants to merge 3 commits intoapache:trunkfrom
Conversation
599a52b to
5da224c
Compare
aliehsaeedii
reviewed
Feb 5, 2026
Contributor
aliehsaeedii
left a comment
There was a problem hiding this comment.
Thanks @frankvicky for the PR. LGTM. Just some suggestions!
| final DataOutputStream out = new DataOutputStream(baos)) { | ||
|
|
||
| final Header[] headerArray = (headers == null) ? new Header[0] : headers.toArray(); | ||
| ByteUtils.writeVarint(headerArray.length, out); |
Contributor
There was a problem hiding this comment.
Ok, so we should always use ByteUtils apis and we should know that it uses zig-zag encoding from.
| try (final ByteArrayOutputStream baos = new ByteArrayOutputStream(); | ||
| final DataOutputStream out = new DataOutputStream(baos)) { | ||
|
|
||
| final Header[] headerArray = (headers == null) ? new Header[0] : headers.toArray(); |
Contributor
There was a problem hiding this comment.
(headers == null || !headers.iterator().hasNext())?
Contributor
Author
There was a problem hiding this comment.
I lean to keep the current code style since it is more straightforward.
WDYT?
| } | ||
|
|
||
| final ByteBuffer buffer = ByteBuffer.wrap(data); | ||
| final int headerCount = ByteUtils.readVarint(buffer); |
Contributor
There was a problem hiding this comment.
var name headersCount?
aliehsaeedii
approved these changes
Feb 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
JIRA: KAFKA-20120
This PR aims to add
HeadersSerializerandHeadersDeserializerasinfrastructure of KIP-1271.